class Solution {
public:
    int maxArea(vector<int>& height) {
        int left = 0, right = height.size() - 1;
        int ret = 0;
        while(left < right)
        {
            int v = (right - left) * min(height[left], height[right]);
            if(height[left] > height[right])
            {
                right--;
            }
            else
            {
                left++;
            }
            ret = max(ret, v);
        }   
        return ret;
    }
};
